//
//  WYRegisterController.m
//  CirclePush
//
//  Created by admin on 2018/4/13.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYRegisterController.h"
#import "WYLoginController.h"
#import "UIButton+CountDown.h"
@interface WYRegisterController ()
@property (strong, nonatomic) IBOutlet UITextField *nameTextFeild;
@property (strong, nonatomic) IBOutlet UITextField *pwdTextfeild;
@property (strong, nonatomic) IBOutlet UITextField *codeTextFeild;
@property (strong, nonatomic) IBOutlet UIButton *codeButton;

@end

@implementation WYRegisterController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    // Do any additional setup after loading the view from its nib.
}
-(void)setupUI
{
    [self initTopBarWithTitle:@""];
    [self addLeftButton:[UIImage imageNamed:@"return"] width:0 height:0];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)registerAction:(id)sender {
    
    WEAKSELF
    [WYHttpServer registeredNumber:self.nameTextFeild.text WithPassword:self.pwdTextfeild.text WithCode:self.codeTextFeild.text SucessBlock:^(BOOL success, id response, NSString *errorMessage) {
        
       
        if (success) {
            [weakSelf toast:@"注册成功"];
//            WYLoginController *lvc = [[WYLoginController alloc]init];
//            [weakSelf.navigationController pushViewController:lvc animated:YES];
            [weakSelf.navigationController popViewControllerAnimated:YES];
        }else{
            
             [weakSelf toast:errorMessage];
           
        }
        
        
        
    }];
    
    
    
    
}
- (IBAction)loginAction:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)getCodeAction:(id)sender {
    
    [self.codeButton startWithTime:59 title:@"重新获取" countDownTitle:@"s后重新获取" mainColor:[UIColor whiteColor] countColor:[UIColor hexStringToColor:@"#3B80F8" alpha:1.0]];
    
    [WYHttpServer sendMessageWithTelephone:self.nameTextFeild.text SucessBlock:^(BOOL success, id response, NSString *errorMessage) {
       
        
        
    }];
    
}


@end
